package org.batatasframework.support.charts.baidu;

import java.util.ArrayList;
import java.util.List;


/**
 * <pre>
 * 
 * </pre>
 * @author jackson
 *
 */
public class ChartOption {
	/**
	 * 标题，每个图表最多仅有一个标题控件
	 */
	private ChartTitle title;
	/**
	 * 是否启用拖拽重计算特性，默认关闭，相关的还有 calculableColor， calculableHolderColor， nameConnector， valueConnector）
	 */
	private boolean calculable;
	private List<ChartAxis> xAxis = new ArrayList<>();
	private List<ChartAxis> yAxis = new ArrayList<>();
	private List<ChartSerie> series = new ArrayList<>();
	
	/**
	 * 工具箱，每个图表最多仅有一个工具箱
	 */
	private ChartToolbox toolbox = new ChartToolbox();
	private ChartTooltip tooltip;
	private ChartLegend legend;
	private ChartVisualMap visualMap;
	private ChartGrid grid = new ChartGrid();
	private List<ChartDataZoom> dataZoom =  new ArrayList<>();
	private String[] color = new String[]{"#c23531","#2f4554","#61a0a8","#d48265","#91c7ae","#749f83","#ca8622","#bda29a","#6e7074","#546570","#c4ccd3"};
	private ChartRadar radar ;

	public ChartTooltip setTooltip(String trigger, String formatter) {
		if(null == tooltip){
			tooltip = new ChartTooltip(trigger, formatter);
		}else{
			tooltip.setTrigger(trigger);
			tooltip.setFormatter(formatter);
		}
		return tooltip;
	}
	
	public void addSerie(ChartSerie serie){
		this.series.add(serie);
	}
	
	public ChartRadar getRadar() {
		return radar;
	}


	public void setRadar(ChartRadar radar) {
		this.radar = radar;
	}


	public String[] getColor() {
		return color;
	}


	public void setColor(String[] color) {
		this.color = color;
	}


	public ChartTitle setTitle(String text){
		if(null == title){
			title = new ChartTitle(text);
		}else{
			title.setText(text);
		}
		return title;
	}


	public ChartTitle setTitle(String text, String subtext){
		if(null == title){
			title = new ChartTitle(text, subtext);
		}else{
			title.setText(text);
			title.setSubtext(subtext);
		}
		return title;
	}
	
	public ChartTitle getTitle() {
		return title;
	}
	public void setTitle(ChartTitle title) {
		this.title = title;
	}
	public boolean isCalculable() {
		return calculable;
	}
	public void setCalculable(boolean calculable) {
		this.calculable = calculable;
	}
	public List<ChartAxis> getxAxis() {
		return xAxis;
	}
	public void setxAxis(List<ChartAxis> xAxis) {
		this.xAxis = xAxis;
	}
	public List<ChartAxis> getyAxis() {
		return yAxis;
	}
	public void setyAxis(List<ChartAxis> yAxis) {
		this.yAxis = yAxis;
	}
	public List<ChartSerie> getSeries() {
		return series;
	}
	public void setSeries(List<ChartSerie> series) {
		this.series = series;
	}
	public ChartToolbox getToolbox() {
		return toolbox;
	}
	public void setToolbox(ChartToolbox toolbox) {
		this.toolbox = toolbox;
	}
	public ChartTooltip getTooltip() {
		return tooltip;
	}
	public void setTooltip(ChartTooltip tooltip) {
		this.tooltip = tooltip;
	}
	public ChartLegend getLegend() {
		return legend;
	}
	public void setLegend(ChartLegend legend) {
		this.legend = legend;
	}


	public ChartVisualMap getVisualMap() {
		return visualMap;
	}


	public void setVisualMap(ChartVisualMap visualMap) {
		this.visualMap = visualMap;
	}
	


	public ChartGrid getGrid() {
		return grid;
	}


	public void setGrid(ChartGrid grid) {
		this.grid = grid;
	}


	public List<ChartDataZoom> getDataZoom() {
		return dataZoom;
	}


	public void setDataZoom(List<ChartDataZoom> dataZoom) {
		this.dataZoom = dataZoom;
	}

	
	
}
